<?php
defined('BY_JYA') or exit('error');
global $_RQ,$_AR;
$_RQ['op']=$_RQ['op']?$_RQ['op']:'get';
$return=array();
$return['types']=array('1'=>'和风天气','2'=>'百度天气');
if($_RQ['op']=='get'){
	$return['item']=$this->get_setting();
	$return['item']['code']="参数获取方法：cfc('jy_heweather')->getweather('深圳市')";
	$return['htmls']=array (
		  'type' => 'edit',
		  'post' => 'post',
		  'edit_tab' => '基本信息',
		  'edits' => 
		  array (
		    0 => 
		    array (
		      'title' => '基本信息',
		      'list' => 
		      array (
				array ('name' => 'type','type' => 'radio','options'=>'types','title' => '接口类型'),
				array ('name' => 'hefeng_key','type' => 'string','title' => '和风KEY','show'=>array('type'=>1),'help'=>'接口说明：https://dev.heweather.com/docs/api/weather'),
				array ('name' => 'baidu_key','type' => 'string','title' => '百度KEY','show'=>array('type'=>2),'help'=>'接口说明：http://apistore.baidu.com/'),
		        array ('name' => 'city','type' => 'pcd','options'=>'pcd','title' => '选择城市'),
				array ('name' => 'code','type' => 'copy','title' => '调用方法'),
		      ),
		    ),
		  ),
		);
	$return['pcd']=cfc('tools')->pcd();	
	exi($return);
}
if($_RQ['op']=='post'){
	$postdata=get_postdata();	
	$this->save_setting($postdata);
	exi('设置成功！','','/jy_heweather/');
}
?>